<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>

Hello Wolrd!
<button onclick="goto()">跳到扫码页面</button>
</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="utils.js"></script>
<script>


    let code = undefined;
    let uid = undefined;

    function goto() {
        window.location.href = "http://imopei.95by.cn/goto/scan.html?uid=" + uid;
    }

    window.onload = function () {
        // 页面重定向后获取用户信息
        let params = getUrlParams();
        code = params["code"];
        uid = params["uid"];
        let domain = "imopei.95by.cn";
        axios.get("http://" + domain + "/api/user/getTokenByCode?code=" + code + "&uid=" + uid).then(res => {
            console.log(res.data);
            if (res.data.code == 200) {
                let token = res.data.data;
                localStorage["token"] = token;
                axios.get("http://" + domain + "/api/user/getUserInfo", {headers: {"token": token}}).then(res => {
                    console.log(res);
                })
            }
        })
    }

</script>
</html>